package com.xhwl.logistics.controller;


import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.vo.cent.alarm.AlarmManagementVO;
import com.xhwl.logistics.dto.VehicleAlarmStatisticDTO;
import com.xhwl.logistics.dto.manipulate.VehicleSyncDTO;
import com.xhwl.logistics.dto.query.VehicleAccessRecordSecondDTO;
import com.xhwl.logistics.service.impl.VehicleAlarmServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 停车场告警信息的接口
 */
//@RestController
public class VehicleAlarmController {

    @Autowired
    private VehicleAlarmServiceImpl vehicleAlarmService;

    /**
     * 根据id获取停车场的今日告警总览
     * @param vehicleSyncDTO
     * @return
     */
    @PostMapping("/alarm/statistics")
    public ResultJson getAlarmStatistics(@RequestBody VehicleSyncDTO vehicleSyncDTO){
        VehicleAlarmStatisticDTO alarmStatistic = vehicleAlarmService.getAlarmStatistic(vehicleSyncDTO);
        return ResultJson.successWithResult(alarmStatistic);
    }

    /**
     * 根据项目id获取停车场的告警记录
     * @param vehicleAccessRecordSecondDTO
     * @return
     */
    @PostMapping("/alarm/record")
    public ResultJson<List<AlarmManagementVO>> getAlarmRecord(@RequestBody VehicleAccessRecordSecondDTO vehicleAccessRecordSecondDTO){
        List<AlarmManagementVO> alarmManagements = vehicleAlarmService.getAlarmManagements(vehicleAccessRecordSecondDTO);
        return ResultJson.successWithResult(alarmManagements);
    }
}
